package com.qk.management.mapper;

import com.qk.entity.Dept;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @Author: chouh
 * @DateTime: 2025/9/29 10:33
 * @Description:
 */
@Mapper
public interface DeptMapper {

    Integer count(@Param("name") String name,
                  @Param("status") Integer status);

    List<Dept> selectByPage(@Param("name") String name,
                            @Param("status") Integer status,
                            @Param("offset") Integer offset,
                            @Param("pageSize") Integer pageSize);

    @Select("SELECT * FROM dept")
    List<Dept> queryAllDepts();

    @Select("SELECT id, name, status, create_time , update_time FROM dept WHERE id = #{id}")
    Dept selectById(Integer id);

    @Update("UPDATE dept SET name = #{name}, status = #{status}, update_time = #{updateTime} WHERE id = #{id}")
    void updateById(Dept dept);

    @Delete("delete from dept where id = #{id}")
    void deleteDept(Integer id);

    @Insert("insert into dept(name,status,create_time,update_time) values(#{name},#{status},#{createTime},#{updateTime})")
    void insertDept(Dept dept);
}
